package client

import "go.uber.org/zap"

//=========================================================
type MemberServerResult struct {
	Code         int                    `json:"code"`
	Msg          string                 `json:"msg"`
	Data         map[string]interface{} `json:"data,omitempty"`
	BusinessCode int                    `json:"businessCode"` // 流水号
}

// @ss_member_service
// POS 会员支付
func (c *Client) MemberPay(schoolId uint, shopId uint, payId string, orderNo string, memberId uint, realAmount uint) *MemberServerResult {
	res := &MemberServerResult{}
	params := map[string]interface{}{
		"schoolId":       schoolId,
		"orderNo":        orderNo,
		"amount":         realAmount,
		"memberId":       memberId,
		"shopId":         shopId,
		"payId":          payId,
		"payNo":          "-",
		"operator":       string(memberId),
		"operatorSource": 4,
	}
	err := c.post("http://ss-member-service/v1/member_wallet/consumption", nil, params, res)
	if err != nil {
		zap.L().Error("@ss_member_service 会员支付 %v\n", zap.Error(err))
		return &MemberServerResult{Code: 0, Msg: "msg"}
	}
	return res
}
